package com.qabaco.odondata.model.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5 {
    public MD5() {
        super();
    }

    public static void main(String[] args) {
        MD5 mD5 = new MD5();
        try {
            System.out.println(mD5.md5("euge1234"));
        } catch (Exception e) {
        }
    }
    /*  */


    public static String md5(String clear) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] b = md.digest(clear.getBytes());

            int size = b.length;
            StringBuffer h = new StringBuffer(size);
            for (int i = 0; i < size; i++) {
                int u = b[i] & 255;
                if (u < 16) {
                    h.append("0" + Integer.toHexString(u));
                } else {
                    h.append(Integer.toHexString(u));
                }
            }
            return h.toString();
        } catch (Exception nsae) {
            nsae.printStackTrace();
        }
        return null;
    }
}
